package content

import androidx.compose.runtime.Composable
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.*
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.awt.ComposeWindow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.ResourceLoader
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import cn.hutool.system.oshi.OshiUtil
import theme.divider

/**
 * @author zooy
 * @create 2024-01-10 21:35
 * @description
 */
@Composable
fun DeviceInfoContent() {

    Column(
        modifier = Modifier
           .fillMaxHeight()
           .fillMaxWidth()
            .verticalScroll(rememberScrollState())
        ,
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getCpuInfo().toString(),
            label = { Text(text = "CPU") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getMemory().toString(),
            label = { Text(text = "MEMORY") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getSystem().toString(),
            label = { Text(text = "SYSTEM") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getNetworkIFs().toString(),
            label = { Text(text = "NETWORK") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getDiskStores().toString(),
            label = { Text(text = "DISK") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getHardware().toString(),
            label = { Text(text = "HARDWARE") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )

        Divider(color = divider)

        OutlinedTextField(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp),
            value = OshiUtil.getProcessor().toString(),
            label = { Text(text = "PROCESSOR") },
            onValueChange = {
            },
            textStyle = MaterialTheme.typography.body2.copy(
                fontWeight = FontWeight.ExtraLight
            ),
            colors = TextFieldDefaults.textFieldColors(
                backgroundColor = MaterialTheme.colors.surface,
                cursorColor = Color.White,
                leadingIconColor = Color.White,
                trailingIconColor = Color.White,
                textColor = Color.White
            )
        )
    }
}
